// $Id: FactionRep.java 15 2010-08-30 18:26:42Z joakim.waltersson@gmail.com $
package se.waltersson.wowarmory.example;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import se.waltersson.wowarmory.ArmoryReader;
import se.waltersson.wowarmory.page.Reputation;

public class FactionRep {
    private Collection<String> keyFactions = new ArrayList<String>();
    public static void main(String[] args) {
        String[] charNames = new String[] {"Adorabella", "Baltsar", "Doropech",
            "Harkel", "Hönstryparen", "Khalez", "Solvei", "Walther" };
        try {
            new FactionRep().fetch(charNames);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private void fetch(String[] charNames) throws IOException {
//        keyFactions.add(Reputation.CENARION_EXPEDITION);
//        keyFactions.add(Reputation.HONOR_HOLD);
//        keyFactions.add(Reputation.LOWER_CITY);
//        keyFactions.add(Reputation.THE_SHATAR);
//        keyFactions.add(Reputation.KEEPERS_OF_TIME);
//        keyFactions.add(Reputation.THE_VIOLET_EYE);
//        keyFactions.add(Reputation.ALDOR);
//        keyFactions.add(Reputation.SCRYERS);
//        keyFactions.add(Reputation.SHATTERED_SUN);
        keyFactions.add(Reputation.ARGENT_CRUSADE);
        keyFactions.add(Reputation.KIRIN_TOR);
        keyFactions.add(Reputation.THE_KALU_AK);
        keyFactions.add(Reputation.THE_WYRMREST_ACCORD);
        keyFactions.add(Reputation.THE_SONS_OF_HODIR);
        List<Reputation> reps = new ArrayList<Reputation>();
        for (String charName : charNames) {
            reps.add(new ArmoryReader().getReputation("Executus", charName));
        }
        for (Reputation r : reps) {
            printFactionRep(r);
        }
    }

    private void printFactionRep(Reputation r) throws IOException {
        System.out.print(r.getCharName());
        for (String faction : keyFactions) {
            System.out.print("\t" + r.getReputation(faction));
        }
        System.out.println();
    }
}
